#include "aerial\Core\Core.h"

#include "aerial\MainMenuScene.h"
#include "aerial\CreateScene.h"
#include "aerial\BattleScene.h"

#include <iostream>
using namespace std;

int main()
{
	int i;
	//cin >> i;
	/*NetIO* netIO;
	if (i == 0 || i == 1)
	{*/
		air::Core* inst = air::Core::create();
		/*netIO = inst->getNetIO();
		netIO->reset();
		netIO->expectedPlayerCount = 3;
		SystemAddress serverSystemAddress("127.0.0.1", 2012);
		SystemAddress clientSystemAddress1("127.0.0.1", 2013);
		SystemAddress clientSystemAddress2("127.0.0.1", 2014);

		netIO->playerInfo[0].id = 0;
		netIO->playerInfo[0].sa = serverSystemAddress;
		netIO->playerInfo[0].userName = "madoka";
		
		netIO->playerInfo[1].id = 1;
		netIO->playerInfo[1].sa = clientSystemAddress1;
		netIO->playerInfo[1].userName = "homura";

		netIO->playerInfo[2].id = 2;
		netIO->playerInfo[2].sa = clientSystemAddress2;
		netIO->playerInfo[2].userName = "kyoko";

		if (i == 0) {
			netIO->server = true; 
			netIO->me = 0;
			cout << "Server scanning...\n";
		} else {
			netIO->server = false;
			netIO->me = 1;
			cout << "Client scanning...\n";
		}
		netIO->startBattle();
		// wait until all the information is collected
		while (!netIO->ReadyBattle()){}
		cout << "Success.\n";
		Packet *p;*/
		/*while (true)
		{
			p = netIO->node->Receive();
			if (p) 
			{
				cout << (int)p->data[0] << endl;
				netIO->node->DeallocatePacket(p);
			}
		}*/
		

		if (inst->initiate())
		{	
			if (inst->addScene(new BattleScene())) 
			{
				inst->start();
			}
		}
		air::Core::release();
	//}
	return 0;
}